package com.qf.dao;

import com.qf.pojo.Type;
import com.qf.util.DataSourceUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 千锋健哥
 */
public class GoodsTypeDaoImpl implements GoodsTypeDao{

    private QueryRunner queryRunner = new QueryRunner(DataSourceUtil.getDataSource());

    @Override
    public List<Type> findAll() {
        try {
            String sql = "select * from tb_goods_type";
            List<Type> list = queryRunner.query(sql, new BeanListHandler<Type>(Type.class));
            return list;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

}
